cmake_minimum_required(VERSION 3.16)
project(test LANGUAGES C CXX)
#使能测试，在构建文件下生成CTestTestfile.cmake文件
enable_testing()

#生成可执行程序
add_executable(main main.c)
add_executable(hello hello.c)
add_executable(world world.c)

#测试
add_test(NAME main_test
         COMMAND main)   
set_tests_properties(main_test PROPERTIES
                     ENVIRONMENT "FOO=main_test")       

add_test(NAME hello_test
         COMMAND hello)
set_tests_properties(hello_test PROPERTIES
                     ENVIRONMENT "FOO=hello_test")  
        
add_test(NAME world_test
         COMMAND world)
set_tests_properties(world_test PROPERTIES
                     ENVIRONMENT "FOO=world_test")
